
var fontBlack = 'rgba(0, 0, 0, 0.8)';

var MY_WARNING_DISPOSE = (function () {

    //设置时间
    function setDateTime(){
        var t = null;
        t = setTimeout(time, 1000); //開始运行
        function time() {
            clearTimeout(t); //清除定时器
            dt = new Date();
            var weekDay = new Array("日", "一", "二", "三", "四", "五", "六");
            var y = dt.getFullYear();
            var mt = dt.getMonth() + 1<10?'0'+(dt.getMonth()+ 1):dt.getMonth()+ 1;
            var day = dt.getDate()<10?'0'+dt.getDate():dt.getDate();
            var h = dt.getHours()<10?'0'+dt.getHours():dt.getHours(); //获取时
            var m = dt.getMinutes()<10?'0'+dt.getMinutes():dt.getMinutes(); //获取分
            var s = dt.getSeconds()<10?'0'+dt.getSeconds():dt.getSeconds(); //获取秒
            var week = dt.getDay();
            document.getElementById("curTime").innerHTML =
                "<span class='timeFont'>"+y+"/"+mt+"/"+day+"</span>" +
                "<span class='timeFont'>星期"+weekDay[week]+"</span>" +
                "<span class='timeFont'>"+h+":"+m+":"+s+"</span>"
            t = setTimeout(time, 1000); //设定定时器，循环运行
        }
    }

    return {
        setDateTime:setDateTime,
    }
})();

$(document).ready(function () {

    MY_WARNING_DISPOSE.setDateTime();

    var url = $("#url").val();

    // 点击顶部菜单时显示逻辑页面
    $('#main-nav').on("click", 'li>a', function() {

        var $that = $(this);
        var url = $that.data("url");

        if (url == undefined || $.trim(url).length == 0 ) {
            return;
        }

        // 菜单可以使用
        $('#business-area').prop("src",url);

        // active 高亮色调整
        var ACTIVE_HORIZONTAL_MENU = 'active_menu';
        $('li>a').removeClass(ACTIVE_HORIZONTAL_MENU);
        $that.addClass(ACTIVE_HORIZONTAL_MENU);
    });

    if (url != undefined && $.trim(url).length > 0) {
        if (url.indexOf('invs_autonomy_examination_daily.do') != -1) {
            $("a[href='#autonomyExamination']").trigger("click");
            $("#autonomyExaminationDaily").trigger("click");
        } else if (url.indexOf('invs_autonomy_examination_overall.do') != -1) {
            $("a[href='#autonomyExamination']").trigger("click");
            $("#autonomyExaminationOverall").trigger("click");
        } else if (url.indexOf('invs_wd_prescription_supervision.do') != -1) {
            $("a[href='#governmentSupervision']").trigger("click");
            $("#prescriptionSupervision").trigger("click");
        } else if (url.indexOf('invs_wd_account_supervision.do') != -1) {
            $("a[href='#governmentSupervision']").trigger("click");
            $("#accountSupervision").trigger("click");
        } else if (url.indexOf('invs_wd_public_evaluation.do') != -1) {
            $("a[href='#socialSupervision']").trigger("click");
            $("#publicEvaluation").trigger("click");
        }
        $("#url").val('');
    } else {
        $("a[href='#autonomyExamination']").trigger("click");
        $("#autonomyExaminationDaily").trigger("click");
    }
});

